<template>
  <div class="right">
    <!-- 面包屑 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item><a href="/">权限管理</a></el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 固定头部表格 -->
    <el-table
    :data="tableData"
    height="450"
    border
    style="width: 100%">
    <el-table-column  label="#" type="index"></el-table-column>
    <el-table-column prop="authName" label="权限名称" width="180"></el-table-column>
    <el-table-column prop="path" label="路经" width="180"></el-table-column>
    <el-table-column prop="level" label="层级">
      <template v-slot:default="{row}">
        <p v-if="row.level === '0'">一级</p>
        <p v-if="row.level === '1'">二级</p>
        <p v-if="row.level === '2'">三级</p>
      </template>
    </el-table-column>
  </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [],
      type:"list"
    }
  },
  created(){
    this.getRightsList()
  },
  methods:{
    getRightsList(){
      this.$axios.get(`rights/${this.type}`).then(res=>{
        if(res.data.meta.status==200){
          console.log(555)
          this.tableData=res.data.data;
        }
        console.log(res)
      })
    }
  }
}
</script>

<style lang="less" scoped>
.el-table{
  margin-top:20px;
}
</style>